Repositioning an istream

Contents|Index|Previous|Next
Repositioning an istream

Use these methods to control the current input position.

streampos istream::tellg ()
Method

Return the current read position, so that you can save it and return to it later with istream::seekg.

istream& istream::seekg (streampos p)
Method

Reset the input pointer (if the input device permits it) to p, usually the result of an earlier call to istream::tellg.

istream& istream::seekg (streamoff offset, ios::seek_dir ref)
Method

Reset the input pointer (if the input device permits it) to offset characters from the beginning of the input, the current position, or the end of input. Specify how to interpret offset with one of the following values for the second argument, ref.

- Interpret loc as an absolute offset from the beginning of the file.
- Interpret loc as an offset relative to the current output position.
- Interpret locas an offset from the current end of the output stream.

Top|Contents|Index|Previous|Next